package morphage.gui;

import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JRadioButtonMenuItem;
import javax.swing.JCheckBoxMenuItem;

import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.ActionEvent;
import javax.swing.KeyStroke;

public class AppMenuBar extends JMenuBar implements ActionListener
{
  private static final long serialVersionUID = 1L;

  public AppMenuBar()
	{
		JMenu 								menu, submenu;
		JMenuItem 						menuItem;
		JRadioButtonMenuItem 	rbMenuItem;
		JCheckBoxMenuItem 		cbMenuItem;
		
		// File
		menu = new JMenu( "File" );
		menuItem = new JMenuItem("New project");
		menu.add( menuItem );
		menuItem = new JMenuItem("Save project");
		menuItem.setAccelerator(KeyStroke.getKeyStroke(
        KeyEvent.VK_S, ActionEvent.CTRL_MASK));
		menu.add( menuItem );
		/*menuItem = new JMenuItem("Save project as ...");
		menu.add( menuItem );*/
		menuItem = new JMenuItem("Open project");
		menu.add( menuItem );
		menu.addSeparator();
		menuItem = new JMenuItem( "Exit" );
		menuItem.addActionListener(this);
		menu.add( menuItem );
		add( menu );
		
		// View
		menu = new JMenu( "View" );
		menuItem = new JCheckBoxMenuItem("Show only intermediate image");
		menu.add( menuItem );
		add( menu );
	}

  @Override
  public void actionPerformed(ActionEvent e)
  {
    if( e.getActionCommand().equals("Exit") )
      System.exit( 0 );
  }
}
